<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/static/js3/jQuery-2.1.4/jquery-2.1.4.min.js"></script>
    <script>
        $(function () {
            // $('#username').blur(function () {
            $('[name=username]').blur(function () {
                console.log(this);
                var name=$(this).val();
                $.get('/exists.do' ,{username:name},function (data) {
                    $('#result').html(data.msg).css('color',data.success?'green':'red');
                })
            })
        })
    </script>
</head>
<body>
<span id="result"></span>
<input type="text" id="username" name="username" placeholder="用户名">
</body>
</html>